#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <string>
#include <clocale>



#pragma once

using namespace std;

class vehicle
{
private:
	int year;
	string brand;
	double sellingprice;
	double purchasingpice;

public:

	vehicle(){
		year = -1;
		sellingprice= purchasingpice=0,0;
		brand = "";
	}
	vehicle(int year, string brand, double sellingprice, double purchasingpice){
		this->year = year;
		this->brand = brand;
		this->sellingprice = sellingprice;
		this->purchasingpice = purchasingpice;
	}

	int GetYear(){
		return year;
	}
	void SetYear(int year) {
		this->year = year;
	}
	string GetBrand(){
		return brand;
	}
	void SetBrand(string brand){
		this->brand = brand;
	}
	double GetSellingprice(){
		return sellingprice;
	}
	void SetSellingprice(double sellingprice){
		this->sellingprice=sellingprice;
	}

	double GetPurchasingpice(){
		return purchasingpice;
	}

	void SetPurchasingpice(double purchasingpice){
		this->purchasingpice=purchasingpice;
	}


	void Read(){

		cout << "Brand =";
		cin >> brand;
		cout << "Year = ";
		cin >> year;
		cout << "Purchasing price =";
		cin >> purchasingpice;
		cout << "Selling price = ";
		cin >> sellingprice;
		
	}
	
	void Write(){

		cout << "Brand = " << brand << endl;
		cout << "Year = " << year << endl;
		cout << "Purchasing price = " << purchasingpice << endl;
		cout << "Selling price = " << sellingprice << endl;

	}
	friend ostream &operator <<(ostream &out, const vehicle &v){
		out << "(";
		out << v.year << ",";
		out << v.brand << ",";
		out << v.purchasingpice << ",";
		out << v.sellingprice << ")";
		return out;
	}

	friend istream &operator >>(istream &in, vehicle &v){

		string s;

		getline(in, s, '(');
		getline(in, s, ',');
		istringstream iss(s);
		iss >> v.year;
		getline(in, v.brand, ',');
		getline(in, s, ',');
		istringstream iss2(s);
		iss2 >> v.purchasingpice;
		getline(in, s, ')');
		istringstream iss3(s);
		iss3 >> v.sellingprice;

		return in;

	}

};

